package org.vectrics.recruiter.struts.tag;

import org.vectrics.SystemException;
import org.vectrics.common.html.TextHelper;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.recruiter.user.resume.email.EmailedResumeInfo;
import org.vectrics.struts.VectricsTagSupport;

public class EmailedResumeSubjectTag extends VectricsTagSupport {
	public static final long serialVersionUID = 62678345;
	private String emailedResumeId = null;
	
	public EmailedResumeSubjectTag() {
		super();
	}

	protected String makeStartTag() {
		if (emailedResumeId == null)
			throw new SystemException("'emailedResumeId' not set for tag");
		EmailedResumeInfo emailResumeInfo = RecruitServiceLocator.getRecruitUserService().findEmailedResume(new Long(this.emailedResumeId));
		if (emailResumeInfo == null)
			throw new SystemException("Object not found for id: " + this.emailedResumeId);

		if (emailResumeInfo.getEmailSubject() == null)
			return TextHelper.getFont("stdFont", this.getPhrase("not.given")).toString();
		else
			return TextHelper.getFont("stdFont", emailResumeInfo.getEmailSubject()).toString();
	}

	/**
	 * @return Returns the emailedResumeId.
	 */
	public String getEmailedResumeId() {
		return emailedResumeId;
	}

	/**
	 * @param emailedResumeId The emailedResumeId to set.
	 */
	public void setEmailedResumeId(String emailedResumeId) {
		this.emailedResumeId = emailedResumeId;
	}

}
